package com.example.demo;


import com.example.demo.security.VerifyServlet;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.ServletRegistrationBean;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.scheduling.annotation.EnableAsync;
import tk.mybatis.spring.annotation.MapperScan;

/**
 * @author xkx
 */
@SpringBootApplication
@EnableAsync
@MapperScan({"com.example.demo.mapper", "com.example.demo.mapper.app"})
@Slf4j
public class DemoApplication {

  public static void main(String[] args) {
    ConfigurableApplicationContext configurableApplicationContext = SpringApplication.run(DemoApplication.class, args);
  }

  /**
   * 注入验证码servlet
   */
  @Bean
  public ServletRegistrationBean indexServletRegistration() {
    ServletRegistrationBean registration = new ServletRegistrationBean(new VerifyServlet());
    registration.addUrlMappings("/getVerifyCode");
    return registration;
  }
}

